# Contributor: Jakub Panek <me@panekj.dev>
# Maintainer: Jakub Panek <me@panekj.dev>
pkgname=xplr
pkgver=0.21.3
pkgrel=0
pkgdesc="Hackable, minimal, fast TUI file explorer"
url="https://xplr.dev"
# s390x, riscv64: rust
# ppc64le: luajit
arch="all !ppc64le !s390x !riscv64"
license="MIT"
makedepends="cargo luajit-dev cargo-auditable"
options="net"
source="
	https://github.com/sayanarijit/xplr/archive/refs/tags/v$pkgver/xplr-$pkgver.tar.gz
	remove-vendored-lua.patch
	"


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --offline --release
}

check() {
	# cargo test doesn't build target/debug/xplr binary
	cargo auditable build --frozen --offline
	cargo test --frozen
}

package() {
	install -Dm755 target/release/xplr -t "$pkgdir"/usr/bin/

	install -Dm644 -t "$pkgdir"/usr/share/applications "$builddir"/assets/desktop/xplr.desktop
	install -Dm644 "$builddir"/assets/icon/xplr.svg "$pkgdir"/usr/share/pixmaps/xplr.svg
	install -Dm644 "$builddir"/assets/icon/xplr.svg "$pkgdir"/usr/share/icons/hicolor/scalable/apps/xplr.svg
	install -Dm644 "$builddir"/assets/icon/xplr16.png "$pkgdir"/usr/share/icons/hicolor/16x16/apps/xplr.png
	install -Dm644 "$builddir"/assets/icon/xplr32.png "$pkgdir"/usr/share/icons/hicolor/32x32/apps/xplr.png
	install -Dm644 "$builddir"/assets/icon/xplr64.png "$pkgdir"/usr/share/icons/hicolor/64x64/apps/xplr.png
	install -Dm644 "$builddir"/assets/icon/xplr128.png "$pkgdir"/usr/share/icons/hicolor/128x128/apps/xplr.png
}

sha512sums="
ee2dbe561e107bed64e70e9cd749cb8752cdd2a41adeb3a45c9fc24db80b196bfbe9d29d0394407f9fab4374555e638b157e2dcdf3008acd9939a27fc256ac1d  xplr-0.21.3.tar.gz
d1f13220b7822b147df60dbff9e8506e7f07b1e11c56bd1c6ca6b7e69b03cb747f29a2daf7a9956bb02196df5912616cabf4c3e248928ce65c7091c111d79136  remove-vendored-lua.patch
"
